package info.ask4research.model.toolsAndMaterials;

import info.ask4research.model.enums.ServiceType;
import info.ask4research.model.roles.Role;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

@Entity
@DiscriminatorValue("SENTMAILSERVICE")
@JsonAutoDetect
public class SentMailService extends ToolAndMaterial {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6363842374730967119L;
	
	@LazyCollection(LazyCollectionOption.FALSE)
	@ManyToMany
    @JoinTable(name="RECIPIENTS",  joinColumns= @JoinColumn(name="role_ID", referencedColumnName="tam_ID"))
	private List<Role> recipients = new ArrayList<Role>();
	
	@Enumerated(EnumType.STRING)
	@Column(name="serviceType")
	private ServiceType serviceType;

	public List<Role> getRecipients() {
		return recipients;
	}

	public void setRecipients(List<Role> recipients) {
		this.recipients = recipients;
	}

	public ServiceType getServiceType() {
		return serviceType;
	}

	public void setServiceType(ServiceType serviceType) {
		this.serviceType = serviceType;
	}

}
